import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_swiper_plus/flutter_swiper_plus.dart';
import 'package:gw_github_flutter/common/route_name.dart';
import 'package:gw_github_flutter/tools/gwGetManager.dart';

class IntroSwiperPage extends StatefulWidget {
  @override
  createState() => SliderScreenState();
}

class SliderScreenState extends State<IntroSwiperPage> {
  SwiperController con = SwiperController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        color: Colors.red,
        child: Swiper(
          itemBuilder: (BuildContext context, int index) {
            return Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                Text(
                  "$index",
                  textAlign: TextAlign.center,
                ),
                const Text("one"),
                index == 2
                    ? ElevatedButton(
                        onPressed: () {
                          GwGetRouteManager.popAndPushName(RouteName.home);
                        },
                        child: const Text("开始"))
                    : const SizedBox.shrink()
              ],
            );
          },
          loop: false,
          controller: con,
          index: 0,
          itemCount: 3,
          pagination: const SwiperPagination(),
          // control: const SwiperControl(),
        ),
      ),
    );
  }
}
